home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1989 / Jul 89 / W0010-Borland Implementat-Jul89 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.0 KB  |  49 lines  |  [TEXT/GEOL]

  1. Item    3396930                         3-July-89        23:30
  2.  
  3. From:   D2019                           Strategy Cons,Tech Supt,Shafer, PRT
  4.  
  5. To:     UK0004                          Bacchus & Smith, Paul Smith
  6.  
  7. cc:     MACAPP.TECH$                    MACAPP Tech
  8.  
  9. Sub:    Borland Implementation of OP
  10.  
  11. As you probably know by now, your first take -- incredible as it may be -- was
  12. correct:  you DO have to call constructors and destructors explicitly and if
  13. you forget to do so, the VMT doesn't get initialized.  Here's from the Borland
  14. docs:
  15.  
  16. "Each individual instance of an object must be initialized by a separate
  17. constructor call.  It is not sufficient to initialize one instance of an object
  18. and then assign that instance to additional instances.  The additional
  19. instances...will not be initialized by the assignment statements and will lock
  20. up the system if their virtual methods are called.
  21.  
  22. (Then there's some transition material.)
  23.  
  24. "What the constructor does is establish a link between the instance calling the
  25. constructor and the object type's VMT.
  26.  
  27. "That's important to remember.  There is only one VMT for each object type.
  28. Individual instances of an object type...contain a link to the VMT -- they do
  29. not contain the VMT itself."
  30.  
  31. On the subject of virtual methods, you are also right.  A method is only
  32. virtual if it is declared so with the key word VIRTUAL.  Further, all virtual
  33. methods must be so labeled:  if the method SHOW is virtual in one object class,
  34. and it recurs, it must be labeled in every other class.  As if that weren't
  35. enough, here's more from their docs:
  36.  
  37. "...the method heading cannot change in any way downward in an object hierarchy
  38. once the method is made virtual.  Headers for all implementations of the same
  39. virtual method must be identical, right down to the number and type of
  40. parameters."
  41.  
  42. (BTW, I obviously agree with you that a discussion here of other
  43. implementations of Object Pascal can be helpful and fruitful but if there's a
  44. lot of disagreement, I'm willing to take the discussion out of MacTech$.)
  45.  
  46. Dan
  47.  
  48.  
  49.